package w83b.w83bOperacionesPaso.w83bActas;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import w83b.w83bBeans.W83bActasBean;
import w83b.w83bUtilidades.W83bUtilidadesComunes;

import es.ejie.frmk.presentacion.operacion.paso.Q70ActionPasoOP;
import es.ejie.frmk.presentacion.sesiondatos.Q70ContextoEJIE;

public class W83bCargarListasOPAction extends Q70ActionPasoOP{

	
	protected void processOP(Q70ContextoEJIE contexto, ActionErrors errores, ActionMapping mapping,
			ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		W83bActasBean actaBean=(W83bActasBean)contexto.get("w83bNuevaActaBean");
		
		W83bActasBean acta = new W83bActasBean();
		
		if(StringUtils.isEmpty(actaBean.getNumActaAno())){
			actaBean = (W83bActasBean)contexto.get("w83bDetalleActaTempBean");
			acta = new W83bActasBean(actaBean);
		}else{
			acta = new W83bActasBean(actaBean);			
		}
		
		if(!"documentos".equals(request.getParameter("accion"))){
			acta = (W83bActasBean)W83bUtilidadesComunes.inicializarPaginador(request, acta);
			actaBean = new W83bActasBean(acta);
		}
		contexto.set("w83bNuevaActaBean",actaBean);
	}

	protected ActionForward processForward(Q70ContextoEJIE contexto, ActionErrors errors, ActionMapping mapping, 
			ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

				W83bActasBean acta=(W83bActasBean)contexto.get("w83bNuevaActaBean");
				acta.setPestana(request.getParameter("accion"));
				return mapping.findForward("ok");

	}

}
